/*--------------------------------------------------------------
 * File: demo17.c 编码类型：C语言  UTF-8
 * Author WRS (1352509846@qq.com)
 * 功能: 求一元二次方程：ax2+bx+c=0 的根。
 * Version 0.1
 * Date 2022-01-03 
 * 
 * @copyright Copyright (c) 2022
 * 
----------------------------------------------------------------*/
#include <stdio.h>
#include <math.h>
int main(int argc, char const *argv[])
{
    float a,b,c,x1,x2,d;
    printf("请输入方程的3个系数：");
    scanf("%f %f %f",&a,&b,&c);

    if(a != 0)
    {
        d = sqrt(b*b - 4*a*c);
        x1 = (-b+d)/(2*a);
        x2 = (-d-b)/(2*a);
        if(x1 < x2)
            printf("%0.2f  %0.2f\n",x2,x1);
        else
            printf("%0.2f  %0.2f\n",x1,x2);
    }

    return 0;
}
